package com.fyzk.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.tyjc.lottery.R;


public class PromptDialog extends Dialog implements android.view.View.OnClickListener{
	
	private Context context;
	private View view;
	private TextView sure;
	private TextView toWeb;
	private TextView web;
	

	public PromptDialog(Context context, int theme) {
		super(context, theme);
		
		this.context = context;
		
		view = LayoutInflater.from(context).inflate(R.layout.dialogprompt, null);
		sure = (TextView) view.findViewById(R.id.dialog_prompt_sure);
		toWeb = (TextView) view.findViewById(R.id.dialog_prompt_toweb);
		web = (TextView) view.findViewById(R.id.dialog_prompt_web);
		
		
		sure.setOnClickListener(this);
		toWeb.setOnClickListener(this);
		web.setOnClickListener(this);
		this.setContentView(view);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.dialog_prompt_sure:
			this.dismiss();
			break;
		case R.id.dialog_prompt_toweb:
			Intent intent = new Intent();        
	        intent.setAction("android.intent.action.VIEW");    
	        Uri content_url = Uri.parse(web.getText().toString());   
	        intent.setData(content_url);  
	        context.startActivity(intent);
			
			this.dismiss();
			break;
		case R.id.dialog_prompt_web:
			this.dismiss();
			break;
		default:
			break;
		}
		
	}

}
